package com.zzc.legou.auth.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class User implements UserDetails {

    private String password;
    private String username;
    private boolean accountNonExpired = true;
    private boolean accountNonLocked = true;
    private boolean credentialsNonExpired = true;
    private boolean enabled = true;
    private Collection<GrantedAuthority> getAuthorities;

    public User(String password, String username, List<GrantedAuthority> getAuthorities) {
        this.password = password;
        this.username = username;
        this.getAuthorities = getAuthorities;
    }


    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return getAuthorities;
    }
}
